//
//  dynamicViewController.m
//  FastRunDemo
//
//  Created by 苟亚明 on 16/9/16.
//  Copyright © 2016年 苟亚明. All rights reserved.
//

#import "dynamicViewController.h"
#import "GYMPublishButton.h"
#import "dynamicHeaderView.h"
#import "CALayer+XC.h"
#import "dynamicContentView1.h"
#import "dynamicContentView2.h"
@interface dynamicViewController ()
/** tableView*/
@property (nonatomic, strong) UITableView *tableView;
/** 图片数组1*/
@property (nonatomic, strong) NSArray *arrayPic1;
/** 图片名字1*/
@property (nonatomic, strong) NSArray *arrayName1;

/** 图片数组2*/
@property (nonatomic, strong) NSArray *arrayPic2;
/** 图片名字2*/
@property (nonatomic, strong) NSArray *arrayName2;
/** 图片数组3*/
@property (nonatomic, strong) NSArray *arrayPic3;
/** 图片名字2*/
@property (nonatomic, strong) NSArray *arrayName3;

@end

@implementation dynamicViewController
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    NSLog(@"dynamicViewController = %p",self);
    
    // 基本设置
    self.view.backgroundColor = [UIColor colorWithRed:238/255.0 green:238/255.0 blue:238/255.0 alpha:1];
    self.automaticallyAdjustsScrollViewInsets = YES;
    
    // 设置数据
    [self setupData];
    
    
    // 设置scrollView
    [self setupScrollView];
}

/**
 * 设置数据
 */
- (void)setupData{
    
    self.arrayPic1 = @[@"dynamic_contentView1_rob",@"dynamic_contentView1_going",@"dynamic_contentView1_payment",@"dynamic_contentView1_noevaluet",@"dynamic_contentView1_isevaluate",@"dynamic_contentView1_cancel",@"dynamic_contentView1_canceling",@"dynamic_contentView1_iscancel"];
    
    self.arrayName1 = @[@"待抢中",
                        @"进行中",
                        @"待付款",
                        @"未评价",
                        @"已评价",
                        @"取消中",
                        @"待取消",
                        @"已取消"];
    self.arrayPic2 = @[@"mycontend_doing",
                       @"mycontend_waitmoney",
                       @"mycontend_waitcomment",
                       @"mycontend_commented",
                       @"mycontend_canceling",
                       @"mycontend_waitcancel",
                       @"mycontend_canceled"];
    self.arrayName2 = @[@"进行中",
                        @"待收款",
                        @"未评价",
                        @"已评价",
                        @"取消中",
                        @"待取消",
                        @"已取消"
                        ];
}

/**
 * 设置scrollView及内容
 */
- (void)setupScrollView{
    
    // 创建背景scrollView
    
    // 初始化bgView
    UIScrollView *bgView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, GYMScreenW, GYMScreenH - 49)];
    [self.view addSubview:bgView];
    
    
    // 创建头部
    dynamicHeaderView *headerView = [[[NSBundle mainBundle]loadNibNamed:@"dynamicHeaderView" owner:nil options:nil]lastObject];
    headerView.y = 10;
    headerView.height = 140;
    
    headerView.width = GYMScreenW;
    
    [bgView addSubview:headerView];
    
    
    // 创建内容1
    dynamicContentView1 *contentBackView1 = [[[NSBundle mainBundle]loadNibNamed:@"dynamicContentView1" owner:nil options:nil]lastObject];
    
    contentBackView1.frame = CGRectMake(0, CGRectGetMaxY(headerView.frame), GYMScreenW, 240);
    
    [bgView addSubview:contentBackView1];
    
    
    // 创建内容2
    dynamicContentView2 *contentBackView2 = [[[NSBundle mainBundle]loadNibNamed:@"dynamicContentView2" owner:nil options:nil]lastObject];
    
    contentBackView2.frame = CGRectMake(0, CGRectGetMaxY(contentBackView1.frame), GYMScreenW, 240);
    
    [bgView addSubview:contentBackView2];
    
    
    // 设置scrollView的contentSize
    bgView.contentSize = CGSizeMake(0, CGRectGetMaxY(contentBackView2.frame));
}




@end
